//
// Created by Administrator on 2022/1/17.
// Procedural Torus
// base on Baker's implementation
//

#ifndef OPENGLLEARN_2_TORUS_H
#define OPENGLLEARN_2_TORUS_H

#include "glm/glm.hpp"
#include "glm/gtc/type_ptr.hpp"
#include "Utils.h"
#include <vector>

class Torus
{
public:
    Torus();
    Torus(float innerRadius, float outerRadius, int precision);
    int getNumVertices() const { return numVertices; }
    int getNumIndices() const { return numIndices; }
    std::vector<int> getIndices() const { return indices; }
    std::vector<glm::vec3> getVertices() const { return vertices; }
    std::vector<glm::vec2> getUVs() const { return uvs; }
    std::vector<glm::vec3> getNormals() const { return normals; }
    // tangent
    std::vector<glm::vec3> getStangents() const { return sTangents; }
    // bitangent
    std::vector<glm::vec3> getTtangents() const { return tTangents; }

private:
    void Init();
    int numVertices;
    int numIndices;
    int precision;
    float inner;
    float outer;
    std::vector<int> indices;
    std::vector<glm::vec3> vertices;
    std::vector<glm::vec2> uvs;
    std::vector<glm::vec3> normals;
    std::vector<glm::vec3> sTangents;
    std::vector<glm::vec3> tTangents;
};

#endif //OPENGLLEARN_2_TORUS_H
